<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>

<%@ include file="/manage/system/pageBase.jsp" %>
<%@ page info="首页" %>
<script type="text/javascript" src="<%=path %>/resource/chart/js/Chart.min.js"></script>
<style type="text/css">
	* {
	    margin: 0px;
	    padding: 0px;  
    }
    .item{
    	font-weight: bold;
    	border-left: 3px solid green;
    	padding-left: 10px
    }
    .content{
    	margin-left: 50px;
    	margin-top: 25px;
    	margin-bottom: 25px
    }
    .square{
    	width:200px;
    	height: 100px;
    	background-color: yellow;
    	border-radius:10px;
    	float: left;
    	margin-right: 100px;
    	text-align: center;
    	padding-top: 20px
    }
    .centerpos{
    	margin: auto auto
    }
</style>
<form action="<%=path%>/manage/user" id="form" method="post">
<body onload='init(${homedata.first})'>
	<div style="margin-left: 30px">
		<h5 class="item">待办事项</h5>
		<div class="content">
			<p>未查看留言：${homedata.todocount}条</p>
		</div>
		<h5 class="item">网站统计</h5>
		<div class="content" style="width:1600px;height: 100px">
			<div class="square">
				<span style="font-weight: bold;font-size: 25px">${homedata.todaycount}</span>
				<br>
				<span>今日访客</span>
			</div>

			<div class="square">
				<span style="font-weight: bold;font-size: 25px">${homedata.yescount}</span>
				<br>
				<span>昨日访客</span>
			</div>

			<div class="square">
				<span style="font-weight: bold;font-size: 25px">${homedata.mescount}</span>
				<br>
				<span>留言数</span>
			</div>

			<div class="square">
				<span style="font-weight: bold;font-size: 25px">${homedata.zixuncount}</span>
				<br>
				<span>咨询人数</span>
			</div>

		</div>
		<h5 class="item">访客统计</h5>

		<div class="content" style="width:1000px;height:250px;">
			<canvas id="myChart" ></canvas>
		</div>
	</div>
</body>
</form>
<script type="text/javascript">
function init(obj){
    if (obj != 1){
        var _form = $("form");
        _form.attr("action", "homedata");
        _form.submit();
    }
}

var ctx = document.getElementById('myChart').getContext('2d');
var myChart = new Chart(ctx, {
    type: 'line',
    data: {
        labels: ['1月', '2月', '3月', '4月', '5月', '6月','7月', '8月', '9月', '10月', '11月', '12月'],
        datasets: [{
            label: '',
            data: [
                ${homedata.yearDatas[0].mcount},
                ${homedata.yearDatas[1].mcount},
                ${homedata.yearDatas[2].mcount},
                ${homedata.yearDatas[3].mcount},
                ${homedata.yearDatas[4].mcount},
                ${homedata.yearDatas[5].mcount},
                ${homedata.yearDatas[6].mcount},
                ${homedata.yearDatas[7].mcount},
                ${homedata.yearDatas[8].mcount},
                ${homedata.yearDatas[9].mcount},
                ${homedata.yearDatas[10].mcount},
                ${homedata.yearDatas[11].mcount}
			],
            borderColor:'rgba(255,215,0)',
            borderWidth: 2,
            fill: false,
        }]
    },
    options: {
		tooltips: {
			intersect: false,
			mode: 'index'
              },
	    elements: {
			line: {
				tension: 0.000001
			}
		},
		legend: {display: false},
		maintainAspectRatio: false
    }
});
</script>
<%@ include file="/manage/system/baseFoot.jsp" %>